<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>机动车档案详情审核</title>
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/easyui_my.css">
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/css.css" />

<script type="text/javascript" src="${ctx}/js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="${ctx}/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${ctx}/js/common.js"></script>
</head>
<script type="text/javascript"> 

var jsonstr="[]";  
var jsonarray = eval('('+jsonstr+')'); 

$(function(){
	var htmlFlagArea="";
	var htmlPicArea = "";
	//循环列表,加载所有图片
	<c:forEach items="${listTpurl}" var="obj" varStatus="status">
	
	var Ocxid="playOcx"+${status.count};
	 if("${status.count}"=="1"){
      var PicAddrEncrypt = "${obj.singleIpaddress}";
      htmlPicArea +="<input type=\"checkbox\" checked=\"checked\" name=\"PrintFlag\" value=\""+${status.count}+"\" style=\"display:none;\">"; 
	  htmlPicArea +="<object id=\""+Ocxid+"\" classid=\"clsid:BCB28301-A827-4DE4-BA67-623FAC960893\" width=\"100%\" height=\"99%\"></object>";	  
	  htmlFlagArea+="<li onClick=\"a_click(this.id)\" id=\"fileNameType"+${status.count}+"\" value=\""+${status.count}+"\" class=\"hoveraddclass\"><a href=\"#\" id=\"fileNameType1"+${status.count}+"\">档案"+${status.count}+"</a></li>";
	 }else{
		  htmlFlagArea+="<li onClick=\"a_click(this.id)\" id=\"fileNameType"+${status.count}+"\" value=\""+${status.count}+"\"><a href=\"#\" id=\"fileNameType1"+${status.count}+"\">档案"+${status.count}+"</a></li>";
	 }
	//生成json数组
	var formdata = {  
            "orderId" : "fileNameType"+"${status.count}",  
            "singleIpaddress" : "${obj.singleIpaddress}"
        };
    jsonarray.push(formdata);
	</c:forEach>
	htmlFlagArea+="<li onClick=\"a_click(this.id)\" id=\"fileNameType000\" ><a href=\"#\" id=\"fileNameType18\">全部</a></li>";
	$("#TableDatatp2").append(htmlPicArea);
	$("#flagLi").append(htmlFlagArea);
	document.getElementById("playOcx1").ImageUrl = PicAddrEncrypt;
	
});


function a_click(o){
	$(".anniuyanshid li").removeClass("hoveraddclass");
	$("#"+o).addClass("hoveraddclass");
	showPic(o);
	checkStaFunc(o);
}
function checkStaFunc(id) {
	//var obj=$("#"+id).previousSbiling;
	var obj=document.getElementById(id);
	$('input[name=PrintFlag]').each(function () {
    if ($(this).val() == $(obj).val()){
	   if($(this).prop("checked")){
			$(this).prop("checked", false);
	   }else{
			$(this).prop("checked", true);
	   }
	}
    else{
       $(this).prop("checked", true);
    }
 });
	
}
//根据文件类型id显示相应的档案图片
function showPic(id){
	$("#TableDatatp2").empty();
	for(var i=0;i<jsonarray.length;i++){
		if(jsonarray[i].orderId==id){
			var str =id.substr(id.length-1,1);
			var Ocxid="playOcx"+str;
			htmlPicArea="";
			htmlPicArea +="<input type=\"checkbox\"  name=\"PrintFlag\" value=\""+str+"\" style=\"display:none;\">";
			htmlPicArea +="<object id=\""+Ocxid+"\" classid=\"clsid:BCB28301-A827-4DE4-BA67-623FAC960893\" width=\"100%\" height=\"99%\"></object>";
			$("#TableDatatp2").append(htmlPicArea);
			//document.getElementById(Ocxid).BindImage(url, 1);
			document.getElementById(Ocxid).ImageUrl = jsonarray[i].singleIpaddress;
			//document.getElementById(Ocxid).WaterImage();
		}else if(id=="fileNameType000"){
			
			var str =jsonarray[i].orderId.substr(jsonarray[i].orderId.length-1,1);
			var Ocxid="playOcx"+str;
			htmlPicArea="";
			htmlPicArea +="<input type=\"checkbox\"  name=\"PrintFlag\" value=\""+str+"\" style=\"display:none;\">";
			//htmlPicArea +="<input type=\"checkbox\"  name=\"showFlag\" value=\""+i+"\" >";
			htmlPicArea +="<object id=\""+Ocxid+"\" classid=\"clsid:BCB28301-A827-4DE4-BA67-623FAC960893\" width=\"100%\" height=\"99%\"></object>";
			$("#TableDatatp2").append(htmlPicArea);
			//console.info(htmlPicArea);
			document.getElementById(Ocxid).ImageUrl = jsonarray[i].singleIpaddress;
		}
	}
}

</script>
<body class="easyui-layout">
	<div data-options="region:'east',border:false" id="TableDatatp1" style="width:300px; background:#f0f0f0;border-left: 1px solid #d2d2d2;">
	<div style="margin: 10px 9px 0;">
	<table cellspacing="0" cellpadding="0" border="0" width="100%" class="dananguanglikuang100">	     
				<tr>
		             <th align="right" height="28" width="100" class="xinjyangshilaiddf1">流水号：</th>
		             <td class="xinjyangshilaiddf1">
		                 <a id="lsh">${info.lsh }</a>
		             </td>
		         </tr>
		     	 <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf2">号牌号码：</th>
		             <td class="xinjyangshilaiddf2">
		                <a id="hphmmc">${info.hphmmc }</a>
		             </td>
		         </tr>
		         <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf1">车辆品牌：</th>
		             <td class="xinjyangshilaiddf1">
		                 <a id="clpp1">${info.clpp1 }</a>
		             </td>
		         </tr>
		         <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf2">号牌种类：</th>
		             <td class="xinjyangshilaiddf2">
		                 <a id="hpzl">${info.hpzlmc }</a>
		             </td>
		             </tr>
		     	 <%-- <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf1">车辆颜色：</th>
		             <td class="xinjyangshilaiddf1">
		                 <a id="csys">${info.csysmc }</a>
		             </td>
		         </tr> --%>
		         <tr>
		              <th align="right" height="28" class="xinjyangshilaiddf2">车辆识别编号：</th>
		             <td class="xinjyangshilaiddf2">
		           	     <a id="clsbdh">${info.clsbdh }</a>
		             </td>
		         </tr>
		         <%-- <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf1">发动机编号：</th>
		             <td class="xinjyangshilaiddf1">
		                <a id="fdjh">${info.fdjh }</a>
		             </td>
		         </tr> --%>
		         <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf1">业务类型：</th>
		             <td class="xinjyangshilaiddf1">
		                <a id="ywmc">${info.ywmc }</a>
		             </td>
		         </tr>
		         <tr>
		             <th align="right" height="28" class="xinjyangshilaiddf2">所有人：</th>
		             <td class="xinjyangshilaiddf2">
		                 <a id="syr">${info.syr }</a>
		             </td>
		         </tr>
		    </table>
		    <div style="height: 60px; padding: 0 65px 0 0;">
		    	 <a href="#" operaType="1" id="print" style=" float: right;margin:12px;display:none;" class="sousuocx">打印</a>
                 <a href="#" operaType="2" id="download" style=" float: right;margin:12px;display:none;" class="sousuocx">下载</a>
                 <input type="hidden" id="currentLsh" value="${info.lsh}"/>
                 <input type="hidden" id="currentHpzl" value="${info.hpzl}"/>
          <%--     <div class="diyipaidhusnfhenfnf1" style="margin:2px;">
					    <c:choose>
	                        <c:when test="${nextXh ne '0'}"> 
	                         <a href="#" style=" float: right; margin: 0 27px 0 0 ;" class="congzhim" onClick="javascript :pageJump('${nextXh }','pageDown');" style="visibility: visible;">下一条</a>
	                        </c:when>
	                        <c:otherwise>
	                            <a href="#" style=" float: right; margin: 0 27px 0 0 ;" class="congzhim">下一条</a>
	                        </c:otherwise>   
	                    </c:choose>
	                    <c:choose>
	                        <c:when test="${preXh ne '0'}"> 
	                            <a href="#" class="congzhim" style=" float: right; margin: 0 8px 0 0 ;" onClick="javascript :pageJump('${preXh}','pageUp');" style="visibility: visible;">上一条</a>
	                        </c:when>
	                        <c:otherwise>
	                            <a href="#" style=" float: right; margin: 0 8px 0 0 ;" class="congzhim1">上一条</a>
	                        </c:otherwise> 
                       </c:choose>
                       <a id="saveId" href="#" style=" float: right; margin: 0 9px 0 0 ;" class="congzhim" onClick="javascript:VerifyAndSave();" style="visibility: visible;">确认审核</a>
	          </div>  --%>
         </div>
		    </div>		
		    
		    
	<div class="anniujiheti">	    
		<ul class="anniuyanshid" id="flagLi">
		    
		</ul>
		<dl class="fangdasuoxiaodan">
			<dd><a href="javascript:OperationPic(1)" id="tubiaos1" title="放大"></a></dd>
			<dd><a href="javascript:OperationPic(2)" id="tubiaos2" title="缩小"></a></dd>
			<dd><a href="javascript:OperationPic(3)" id="tubiaos3" title="左旋转"></a></dd>
			<dd><a href="javascript:OperationPic(4)" id="tubiaos4" title="右旋转"></a></dd>
		</dl>
	</div>      
	</div>
	<div data-options="region:'center',border:false" id="TableDatatp2">
	
	</div>


</body>

<script type="text/javascript">
function OperationPic(type){
	$('input[name=PrintFlag]').each(function () {   
		   if($(this).prop("checked")){
			 var str =$(this).val();
			 var playOcxId = "playOcx"+str.substr(str.length-1,1);
			 if(type=="1"){
				 document.getElementById(playOcxId).ZoomIn(); 
			 }else if(type=="2"){
				 document.getElementById(playOcxId).ZoomOut(); 
			 }else if(type=="3"){
		   		 document.getElementById(playOcxId).RotateImage(0);
			 }else if(type=="4"){
		   		 document.getElementById(playOcxId).RotateImage(1);
			 }
		   }
      });
}

$(function(){
	$('#del,#download,#print').hide();
	//加载权限
	$.ajax({
		type:'POST',
        url:'${ctx}/audit/queryAuditInfo.htm',
        data:{
        	//hphm:$.trim($('#hphmmc').text()),
        	//hpzl:$.trim($('#currentHpzl').val()),
        	lsh:$.trim($('#lsh').text()),
        	xh:$.trim($('#currentXh').val())
        },
        dataType:'json',
        success:function(data, textStatus, jqXHR){
        	if(null!=data && undefined!=data){
        		var applyNo01='';
                var applyNo02='';
        		$.each(data,function(i,info){
        			var permissionType=info.permissionType;//权限类型  03 删除权限 02 下载权限 01 打印权限
        			if(permissionType=='01'){
        				$('#print').show();
        				applyNo01=info.applyNo;
        			}
        			if(permissionType=='02'){
                        $('#download').show();
                        applyNo02=info.applyNo;
        			}
        		});
                $('#print,#download').unbind('click').bind('click',function(){
                	$.ajax({
                    	type:'POST',
                        url:'${ctx}/yxxxgl/countPrintNum.htm',
                        data:{
                        	applyNo:applyNo01
                        },
                        dataType:'json',
                        success:function(data, textStatus, jqXHR){
                        	debugger;
                        	//统计打印次数，在后台进行，前台不需要进行任何提示
                        	
                        }
                    }); 
                    var operaType=$(this).attr('operaType');
                    if(operaType=='1'){
                    	$('input[name=PrintFlag]').each(function () {
                   		   if($(this).prop("checked")){
                   			 var str =$(this).val();
                   			 var playOcxId = "playOcx"+str.substr(str.length-1,1)
                   		     document.getElementById(playOcxId).PrintImage();
                   		   }
                         });
                    }else if(operaType=='2'){

                        if(confirm('确认下载图片?')){
                             var lsh=$("#currentLsh").val();
                            //window.location.href='${ctx}/yxxxgl/downloadSinglePic.htm?ids='+Ids;
                            window.location.href="${ctx}/yxxxgl/downloadSinglePic.htm?ids="+lsh+"&applyNo="+applyNo02;

						}
                    }
                });
        	}
        }
	});
})

</script>